package com.imooc.security.core.validate.code.sms;

import com.imooc.security.core.validate.code.ValidateCode;
import com.imooc.security.core.validate.code.ValidateCodeGenerator;
import org.apache.commons.lang.RandomStringUtils;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
@Component
public class SmsValidateCodeGenerator implements ValidateCodeGenerator {

	@Override
	public ValidateCode generate(HttpServletRequest request) {

		String code = RandomStringUtils.randomNumeric(4);

		ValidateCode validateCode = new ValidateCode();
		validateCode.setCode(code);

		return validateCode;

	}
}
